package xy.come.juhenews.Uitils;

import android.content.Context;
import android.graphics.Color;

import com.zyao89.view.zloading.ZLoadingDialog;
import com.zyao89.view.zloading.Z_TYPE;

import java.util.Timer;
import java.util.TimerTask;

/**
 * Created by Xia_焱 on 2018/7/20.
 * e-mail：XiahaotianV@163.com
 */

public class LoadingDialog {

    private final ZLoadingDialog dialog;
    private Timer timer;
    public LoadingDialog(Context context) {
        dialog = new ZLoadingDialog(context);
        dialog.setCancelable(false);
        dialog.setLoadingBuilder(Z_TYPE.STAR_LOADING)
                .setLoadingColor(Color.parseColor("#ff5305"))
                .setHintText("Loading...")
//                                .setHintTextSize(16) // 设置字体大小
                .setHintTextColor(Color.GRAY)  // 设置字体颜色
//                                .setDurationTime(0.5) // 设置动画时间百分比
                .setDialogBackgroundColor(Color.parseColor("#ffffff")); // 设置背景色

    }
    public void LoadingShow(){
        dialog.show();
    }
    public void LoadingDismiss(){
        timer = new Timer();
        timer.schedule(new TimerTask() {
            @Override
            public void run() {
                dialog.dismiss();
            }
        }, 100, 2 * 1000);

    }

}
